home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / news / thor / rexx / selectedreply2enter.thor < prev    next >
Text File  |  1998-05-24  |  2KB  |  67 lines

  1. /* $VER: SelectedReply2Enter.thor 1.0 (28.2.95)
  2.  *
  3.  * Convert a selected reply event on a bbs to an enter event.
  4.  *
  5.  * Script by: Troels Walsted Hansen with 99% code ripped from
  6.  * Reply2Enter.br by Eivind Nordseth, Ultima Thule Software.
  7.  *
  8.  */
  9.  
  10.     options results
  11.  
  12.     EVE_ENTERMSG     =  0   /* Enter message */
  13.     EVE_REPLYMSG     =  1   /* Reply message */
  14.  
  15.     EDF_DELETED       = '00000001'x   /* Event is deleted */
  16.     EDF_DONE          = '00000004'x   /* Event is done */
  17.     EDF_ERROR         = '00000008'x   /* Error performing this event */
  18.     EDF_FREEZE        = '00000020'x   /* Event is frozen. Will not be done as long as this flag is set. */
  19.  
  20.     /* needs THOR and bbsread.library functions */
  21.  
  22.     p = ' ' || address() || ' ' || show('P',,)
  23.     thorport = pos(' THOR.',p)
  24.  
  25.     if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  26.     else
  27.     do
  28.         say 'No THOR port found!'
  29.         exit 10
  30.     end
  31.  
  32.     if ~show('p', 'BBSREAD') then do
  33.         address command
  34.             "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  35.             "WaitForPort BBSREAD"
  36.     end
  37.  
  38.     /* get current BBS and current selected eventnumber */
  39.  
  40.     address(thorport)
  41.     CURRENTBBS stem CURRENT
  42.     GETSELECTEDEVENT
  43.     n = result
  44.  
  45.     address(bbsread)
  46.     READBREVENT '"'CURRENT.BBSNAME'"' eventnr n datastem EVENTDATA tagsstem EVENTTAGS
  47.     if(rc ~= 0) then
  48.     do
  49.         address(thorport)
  50.         REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Abort"'
  51.         exit
  52.     end
  53.  
  54.     if EVENTDATA.EVENTTYPE == EVE_REPLYMSG then
  55.     do
  56.         if bitand(EVENTDATA.FLAGS, bitor(bitor(bitor(EDF_DELETED, EDF_DONE), EDF_ERROR), EDF_FREEZE)) = '00000000'x then
  57.         do
  58.             WRITEBREVENT '"'CURRENT.BBSNAME'"' event EVE_ENTERMSG stem EVENTTAGS updateeventnr n
  59.             if(rc ~= 0) then
  60.             do
  61.                 address(thorport)
  62.                 REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Abort"'
  63.                 exit
  64.             end
  65.         end
  66.     end
  67.